ELF unexec: R_*_NONE relocs
authorAlan Modra <amodra@gmail.com>
Sun, 8 Nov 2015 17:29:00 +0000 (09:29 -0800)
committerRob Browning <rlb@defaultvalue.org>
Mon, 18 Jan 2016 21:17:31 +0000 (15:17 -0600)
Emacs should build on ppc64el.  A problem with the bss has been fixed.

This upstream patch has been added [6/10]:

  ELF unexec: R_*_NONE relocs

  These should be ignored on all targets.

  * unexelf.c (unexec): Ignore R_*_NONE relocs for any target,
  not just Alpha.  Comment on reloc size assumption.

Origin: upstream, commit: 8285c2ab8050de218c0c06182659ee0a7b23a0f6
Bug: http://debbugs.gnu.org/20614
Bug-Debian: http://bugs.debian.org/808347
Added-by: Rob Browning <rlb@defaultvalue.org>
src/unexelf.c

index 58f0ad0bb2c21e4967d966fdc6540cd9e9e6e52c..1d9387e534c51243d93136a7a9a8e2c3915dff52 100644 (file)
@@ -1203,7 +1203,7 @@ temacs:
     }
 
   /* This loop seeks out relocation sections for the data section, so
-     that it can undo relocations performed by the runtime linker.  */
+     that it can undo relocations performed by the runtime loader.  */
   for (n = new_file_h->e_shnum; 0 < --n; )
     {
       ElfW (Shdr) *rel_shdr = &NEW_SECTION_H (n);
@@ -1236,14 +1236,14 @@ temacs:
                   reloc += rel_shdr->sh_entsize)
                {
                  ElfW (Addr) addr = ((ElfW (Rel) *) reloc)->r_offset - offset;
-#ifdef __alpha__
-                 /* The Alpha ELF binutils currently have a bug that
-                    sometimes results in relocs that contain all
-                    zeroes.  Work around this for now...  */
+                 /* Ignore R_*_NONE relocs.  */
                  if (((ElfW (Rel) *) reloc)->r_offset == 0)
                    continue;
-#endif
-                 memcpy (new_base + addr, old_base + addr, sizeof (ElfW (Addr)));
+                 /* Assume reloc applies to a word.
+                    ??? This is not always true, eg. TLS module/index
+                    pair in .got which occupies two words.  */
+                 memcpy (new_base + addr, old_base + addr,
+                         sizeof (ElfW (Addr)));
                }
            }
          break;